package com.util;

import java.util.Random;
import java.util.UUID;

public class GenerateId {

	private GenerateId() {
	}

	public static String uuid32() {
		UUID uuid = UUID.randomUUID();
		return uuid.toString().replaceAll("-", "");
	}

	public static int gereatesixint() {
		int[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
		Random rand = new Random();
		for (int i = 10; i > 1; i--) {
			int index = rand.nextInt(i);
			int tmp = array[index];
			array[index] = array[i - 1];
			array[i - 1] = tmp;
		}
		int result = 0;
		for (int i = 0; i < 6; i++)
			result = result * 10 + array[i];
		return result;

	}

	public static Integer generateId() {
		Integer d = 2000000000;
		return d + GenerateId.gereatesixint();
	}

	public static int generateId(int t1) {
		StringBuffer sb = new StringBuffer("1");
		if (t1 < 10 && t1 >= 0) {
			sb.append("0").append(t1);
		} else {
			sb.append(t1);
		}
		sb.append(GenerateId.getFixLenthString(7));
		return Integer.parseInt(sb.toString().substring(0, 10));
	}

	/*
	 * 返回长度为【strLength】的随机数，在前面补0
	 */
	private static String getFixLenthString(int strLength) {
		Random rm = new Random();
		// 获得随机数
		double pross = (1 + rm.nextDouble()) * Math.pow(10, strLength);
		// 将获得的获得随机数转化为字符串
		String fixLenthString = String.valueOf(pross);
		// 返回固定的长度的随机数
		return fixLenthString.substring(2, strLength + 2);
	}

	public static int generateIntByNum(int num) {
		int[] array = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
		Random rand = new Random();
		for (int i = 10; i > 1; i--) {
			int index = rand.nextInt(i);
			int tmp = array[index];
			array[index] = array[i - 1];
			array[i - 1] = tmp;
		}
		int result = 0;
		for (int i = 0; i < num; i++)
			result = result * 10 + array[i];
		return result;

	}

	public static int generateChannelId(int type) {
		return 10000 * type + GenerateId.generateIntByNum(4);
	}

	public static String getRandomString2(int length) {
		Random random = new Random();
		StringBuffer sb = new StringBuffer();
		for (int i = 0; i < length; i++) {
			int number = random.nextInt(3);
			long result = 0;
			switch (number) {
			case 0:
				result = Math.round(Math.random() * 25 + 65);
				sb.append(String.valueOf((char) result));
				break;
			case 1:
				result = Math.round(Math.random() * 25 + 97);
				sb.append(String.valueOf((char) result));
				break;
			case 2:
				sb.append(String.valueOf(new Random().nextInt(10)));
				break;
			}
		}
		return sb.toString();
	}

	public static void main(String args[]) {
		String[] strs = { "admin,admin,管理员,anxinyisheng@anxinyisheng.com",
				"angela.gui,桂,芝兰,angela.gui@anxinyisheng.com", "changhuai.zhao,赵,长怀,changhuai.zhao@anxinyisheng.com",
				"shawn.xue,薛,勇,shawn.xue@anxinyisheng.com", "wenwu.liu,刘,文武,wenwu.liu@anxinyisheng.com",
				"dennis.zhao,赵,鹏,dennis.zhao@anxinyisheng.com", "yiyao.shen,沈,益瑶,yiyao.shen@anxinyisheng.com",
				"yuan.ruan,阮,元,yuan.ruan@anxinyisheng.com", "likai.tian,田,立凯,likai.tian@anxinyisheng.com",
				"wenkai.liu,刘,文凯,wenkai.liu@anxinyisheng.com", "xiaohui.wang,王,晓晖,xiaohui.wang@anxinyisheng.com",
				"qianru.long,龙,茜茹,qianru.long@anxinyisheng.com", "xing.sun,孙,兴,xing.sun@anxinyisheng.com",
				"sitai.tang,唐,思泰,sitai.tang@anxinyisheng.com", "muzhan.cai,蔡,木展,muzhan.cai@anxinyisheng.com",
				"du.feng,冯,度,du.feng@anxinyisheng.com", "yunjun.lin,林,云军,yunjun.lin@anxinyisheng.com",
				"weiguo.zhu,朱,伟国,weiguo.zhu@anxinyisheng.com", "zengshi.wen,文,增石,zengshi.wen@anxinyisheng.com",
				"aihua.zhou,周,爱华,aihua.zhou@anxinyisheng.com", "chun.hui,回,春,chun.hui@anxinyisheng.com",
				"xuejing.fu,付,雪净,xuejing.fu@anxinyisheng.com", "cheng.yang,杨,程,cheng.yang@anxinyisheng.com",
				"sherry.liang,梁,雯,sherry.liang@anxinyisheng.com", "wei.zhu,朱,伟,wei.zhu@anxinyisheng.com",
				"tianpeng.zhao,赵,天鹏,tianpeng.zhao@anxinyisheng.com", "ruichao.wang,王,瑞超,ruichao.wang@anxinyisheng.com",
				"jessica.mu,卡,卡,jie.mu@anxinyisheng.com", "zhuoming.ma,马,卓明,zhuoming.ma@anxinyisheng.com",
				"liangliang.zhu,朱,亮亮,liangliang.zhu@anxinyisheng.com", "jack.ge,葛,星,jack.ge@anxinyisheng.com",
				"xin.ren,任,鑫,xin.ren@anxinyisheng.com", "bingjia.yang,杨,冰佳,bingjia.yang@anxinyisheng.com",
				"guangqi.zhang,张,广启,guangqi.zhang@anxinyisheng.com",
				"xiaoqiang.duan,段,小强,xiaoqiang.duan@anxinyisheng.com",
				"lingfei.wang,王,凌飞,lingfei.wang@anxinyisheng.com", "jiangbo.liu,刘,江波,jiangbo.liu@anxinyisheng.com",
				"yang.zhang,张,扬,yang.zhang@anxinyisheng.com", "di.yuan,袁,迪,di.yuan@anxinyisheng.com",
				"susan.chu,褚,晓姝,susan.chu@anxinyisheng.com", "hongfeng.zhang,张,洪峰,hongfeng.zhang@anxinyisheng.com",
				"yonggan.hong,洪,勇敢,yonggan.hong@anxinyisheng.com", "yunqing.mo,莫,云卿,yunqing.mo@anxinyisheng.com",
				"jia.gao,杲,佳,jia.gao@anxinyisheng.com", "yue.mu,慕,月,yue.mu@anxinyisheng.com",
				"bin.yu,俞,斌,bin.yu@anxinyisheng.com", "yanmei.li,李,艳梅,yanmei.li@anxinyisheng.com",
				"fang.lan,兰,芳,fang.lan@anxinyisheng.com", "wenhua.li,李,文华,wenhua.li@anxinyisheng.com",
				"jian.zhang,张,建,jian.zhang@anxinyisheng.com", "wenjia.bai,白,文佳,wenjia.bai@anxinyisheng.com",
				"jiawei.tian,田,佳伟,jiawei.tian@anxinyisheng.com", "yanhui.li,李,彦辉,yanhui.li@anxinyisheng.com",
				"ziye.wang,王,梓烨,ziye.wang@anxinyisheng.com", "ni.wang,王,妮,ni.wang@anxinyisheng.com",
				"ziyi.tao,陶,子溢,ziyi.tao@anxinyisheng.com", "jiawei.hou,侯,佳伟,jiawei.hou@anxinyisheng.com",
				"yinchuan,银川,互联网医院,it@anxinyisheng.com", "yan.wang,汪,琰,yan.wang@anxinyisheng.com",
				"yin.liu,刘,茵,yin.liu@anxinyisheng.com", "ziwei.wu,吴,子威,ziwei.wu@anxinyisheng.com",
				"tianxiang.chen,陈,天翔,tianxiang.chen@anxinyisheng.com",
				"changming.liu,刘,昌明,changming.liu@anxinyisheng.com", "riming.su,苏,日明,riming.su@anxinyisheng.com",
				"zhaoli.sun,孙,照利,zhaoli.sun@anxinyisheng.com", "qian.zhang,张,倩,qian.zhang@anxinyisheng.com",
				"xuesen.wang,王,雪森,xuesen.wang@anxinyisheng.com", "yc.office,银川,Office,it@anxinyisheng.com",
				"wei.zhao,赵,薇,wei.zhao@anxinyisheng.com", "haiyang.zhang,张,海阳,haiyang.zhang@anxinyisheng.com",
				"qiuxiong.huang,黄,秋雄,qiuxiong.huang@anxinyisheng.com" };

		for (int i = 0; i < strs.length; i++) {
			String s = strs[i];
//			String pwd = GenerateId.getRandomString2(8);
//			System.out.println(s + "," + pwd);
//			 System.out.println(s.split(",")[0] + ",ssoauth-users");
			 System.out.println("\"" + s.split(",")[0] + "\",");
			// String[] kk = s.split(",");
			// System.out.println(kk[0]+","+kk[4]);
		}
	}

}
